wl_callback_add_listener(callback, &init_sync_listener, display);
}
+static void
+xdg_shell_ping (void *data,
+ struct xdg_shell *xdg_shell,
+ uint32_t serial)
+{
+ GdkWaylandDisplay *wayland_display = data;
+
+ _gdk_wayland_display_update_serial (wayland_display, serial);
+
+ xdg_shell_pong (xdg_shell, serial);
+}
+
+static const struct xdg_shell_listener xdg_shell_listener = {
+ xdg_shell_ping,
+};
+
static void
gdk_registry_handle_global(void *data, struct wl_registry *registry, uint32_t id,
const char *interface, uint32_t version)
display_wayland->xdg_shell =
wl_registry_bind(display_wayland->wl_registry, id, &xdg_shell_interface, 1);
xdg_shell_use_unstable_version(display_wayland->xdg_shell, XDG_SHELL_VERSION_CURRENT);
+ xdg_shell_add_listener(display_wayland->xdg_shell, &xdg_shell_listener, display_wayland);
} else if (strcmp(interface, "gtk_shell") == 0) {
display_wayland->gtk_shell =
wl_registry_bind(display_wayland->wl_registry, id, >k_shell_interface, 1);
&surface_listener, window);
}
-static void
-xdg_surface_ping (void *data,
- struct xdg_surface *xdg_surface,
- uint32_t serial)
-{
-
- GdkWindow *window = GDK_WINDOW (data);
- GdkWaylandDisplay *wayland_display =
- GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
-
- _gdk_wayland_display_update_serial (wayland_display, serial);
-
- xdg_surface_pong (xdg_surface, serial);
-}
-
static void
xdg_surface_configure (void *data,
struct xdg_surface *xdg_surface,
}
static const struct xdg_surface_listener xdg_surface_listener = {
- xdg_surface_ping,
xdg_surface_configure,
xdg_surface_request_set_fullscreen,
xdg_surface_request_unset_fullscreen,
xdg_surface_set_app_id (impl->xdg_surface, gdk_get_program_class ());
}
-static void
-xdg_popup_ping (void *data,
- struct xdg_popup *xdg_popup,
- uint32_t serial)
-{
- GdkWindow *window = GDK_WINDOW (data);
- GdkWaylandDisplay *wayland_display =
- GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
-
- _gdk_wayland_display_update_serial (wayland_display, serial);
-
- xdg_popup_pong (xdg_popup, serial);
-}
-
static void
xdg_popup_done (void *data,
struct xdg_popup *xdg_popup,
}
static const struct xdg_popup_listener xdg_popup_listener = {
- xdg_popup_ping,
xdg_popup_done,
};
Use this enum to check the protocol version, and it will be updated
automatically.
</description>
- <entry name="current" value="1" summary="Always the latest version"/>
+ <entry name="current" value="2" summary="Always the latest version"/>
</enum>
<arg name="y" type="int"/>
<arg name="flags" type="uint"/>
</request>
+
+ <event name="ping">
+ <description summary="check if the client is alive">
+ The ping event asks the client if it's still alive. Pass the
+ serial specified in the event back to the compositor by sending
+ a "pong" request back with the specified serial.
+
+ Compositors can use this to determine if the client is still
+ alive. It's unspecified what will happen if the client doesn't
+ respond to the ping request, or in what timeframe. Clients should
+ try to respond in a reasonable amount of time.
+ </description>
+ <arg name="serial" type="uint" summary="pass this to the callback"/>
+ </event>
+
+ <request name="pong">
+ <description summary="respond to a ping event">
+ A client must respond to a ping event with a pong request or
+ the client may be deemed unresponsive.
+ </description>
+ <arg name="serial" type="uint" summary="serial of the ping event"/>
+ </request>
</interface>
<interface name="xdg_surface" version="1">
<arg name="app_id" type="string"/>
</request>
- <request name="pong">
- <description summary="respond to a ping event">
- A client must respond to a ping event with a pong request or
- the client may be deemed unresponsive.
- </description>
- <arg name="serial" type="uint" summary="serial of the ping event"/>
- </request>
-
- <event name="ping">
- <description summary="ping client">
- Ping a client to check if it is receiving events and sending
- requests. A client is expected to reply with a pong request.
- </description>
- <arg name="serial" type="uint"/>
- </event>
-
<request name="move">
<description summary="start an interactive move">
Start a pointer-driven move of the surface.
</description>
</request>
- <request name="pong">
- <description summary="respond to a ping event">
- A client must respond to a ping event with a pong request or
- the client may be deemed unresponsive.
- </description>
- <arg name="serial" type="uint" summary="serial of the ping event"/>
- </request>
-
- <event name="ping">
- <description summary="ping client">
- Ping a client to check if it is receiving events and sending
- requests. A client is expected to reply with a pong request.
- </description>
- <arg name="serial" type="uint"/>
- </event>
-
<event name="popup_done">
<description summary="popup interaction is done">
The popup_done event is sent out when a popup grab is broken,